﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RBOSS.Data;
using System.Collections;
using RBOSS.Business.CustomerModule;

namespace RBOSS.Business.Products
{
    public class VendorProducts
    {
        public int ProductId { get; set; }
        public int UserId { get; set; }
        public int CategoryId { get; set; }
        public string ProductName { get; set; }
        public decimal UnitPrice { get; set; }
        public string Image { get; set; }
        public int Quantity { get; set; }
        public string Description { get; set; }
        public bool IsProductActive { get; set; }
        public bool IsProductEnabled { get; set; }

        RBOSSEntities rb = new RBOSSEntities();
        public List<VendorProducts> getvendorproduct(String email)
        {
            var ar = new List<VendorProducts>();
            VendorProducts v;
            CustomerSubSystem objCustomer = new CustomerSubSystem();
            int nUserID = objCustomer.GetCustomerId(email);

            var query = rb.Products.Where(e => e.UserId == nUserID);
            foreach (var item in query)
            {
                v = new VendorProducts();
                v.ProductId = item.ProductId;
                v.ProductName = item.ProductName;
                v.UnitPrice = item.UnitPrice;
                v.Image = item.Image;
                v.Quantity = item.Quantity;
                v.Description = item.Description;
                v.IsProductActive = item.IsProductActive;
                v.IsProductEnabled = item.IsProductEnabled;
                ar.Add(v);
                
            }
            return ar;
        }

    }
}
